go to previous page   go to home page   go to next page        

Answer:

Compile it into Java bytecodes, then run the bytecode with the Java interpreter.

Running the Program

To do all that, find the DOS command window you started up a while back. It should still be positioned in the C:\Temp directory. To check that you put the source file Hello.java in this directory, enter the command dir *.java. You should see the source file, as below.

C:\TEMP>dir *.java
 Volume in drive C has no label.
 Volume Serial Number is 7C68-1E55

 Directory of C:\TEMP

 08/23/98  01:07a                   115 Hello.java
               1 File(s)            115 bytes
                          2,448,368,640 bytes free

To compile the source file (thereby producing a file of bytecodes) enter the command javac Hello.java.

C:\TEMP>javac Hello.java
  compiling: Hello.java

If you see the following

C:\TEMP>javac Hello.java
The name specified is not recognized as an
internal or external command, operable program or batch file.

then the PATH environment variable has not been set correctly. Either go back and figure out how to do that, or use the directory
C:\Program Files\Java\jdk1.5.0_06 instead of C:\TEMP.

Finally, to run the program, enter the command java Hello.

C:\TEMP>java Hello

Hello World!

C:\TEMP>

 

QUESTION 19:

After all of this, what did the Java program actually do?